package com.yuanfeng.userms.feign;

import com.yuanfeng.commoms.util.ResponseResult;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@FeignClient(name = "mall-base", url = "http://localhost:8011")
public interface BaseServiceClient {

    /**
     * 修改会员等级
     *
     * @param map
     * @return
     */
    @PostMapping("/base/tagClass/updateTagClassByUserId")
    ResponseResult updateTagClassByUserId(@RequestBody Map<String, Object> map);

    /**
     * 查询所有会员等级
     *
     * @param map
     * @return
     */
    @PostMapping("base/membershipGrade/queryMembershipGrade")
    ResponseResult queryMembershipGrade(@RequestBody Map<String, Object> map);


    /**
     * 查询积分规则
     *
     * @return
     */
    @PostMapping("/base/integralRules/queryIntegralRules")
    ResponseResult queryIntegralRules();

    /**
     * 根据configKey查configValue
     *
     * @param configKey
     * @return
     */
    @GetMapping("/base/sysConfig/selectByConfigKey")
    ResponseResult selectByConfigKey(@RequestParam("configKey") String configKey);


    /**
     * 查询plus 会员 套餐信息  feign
     */
    @PostMapping("/base/plusRuleThali/query")
    ResponseResult queryMerchantPlusThali(@RequestBody Map<String, Object> map) throws IllegalAccessException;


    /**
     * 注册修改会员等级
     * @param map
     * @return
     */
    @PostMapping("/base/tagClass/saveTagClass")
    ResponseResult saveTagClass(@RequestBody Map<String, Object> map);

    /**
     * feign调用 根据用户id查询会员等级名称
     * @param userId
     * @return
     */
    @PostMapping("base/membershipGrade/queryByUserId")
    public Map<String,Object> queryMemberShipGradeByUserId(@RequestParam("userId")String userId);

    /**
     * 根据查询会员积分最大值
     * @return
     */
    @PostMapping("base/membershipGrade/getMaxMemberIntegral")
    public Integer getMaxMemberIntegral();

    /**
     * feign调用 查询会员用户距离下一级积分
     * @param userId
     * @return
     */
    @PostMapping("base/membershipGrade/getMemberIntegralDistance")
    ResponseResult getMemberIntegralDistance (@RequestParam("userId")String userId);

    /**
     * 查询地区 feign
     * @param provinceId
     * @return
     */
    @PostMapping("/base/district/queryProvinceport")
    String queryProvinceport(@Param("provinceId")String provinceId);

    /**
     * 根据用户id查询会员等级id
     * @param userId
     * @return
     */
    @PostMapping("/base/tagClass/queryByUserId")
    ResponseResult getMemberClassIdByUserId(@RequestParam("userId") String userId);



    /**
     * 根据会员等级id查询会员等级
     * @param id
     * @return
     */
    @PostMapping("/base/membershipGrade/getMemberNameByClassId")
    ResponseResult getMemberNameByClassId(@RequestParam("id") String id);


    /**
     * 得到地址信息
     *
     * @param provinceId
     * @param cityId
     * @param districtId
     * @return
     */
    @GetMapping("/base/district/getAddressString")
    ResponseResult getAddressString(@RequestParam("province") Integer provinceId, @RequestParam("city") Integer cityId,
                            @RequestParam("county") Integer districtId);



    /**
     * 查询积分规则
     *
     * @param map
     * @return
     */
    @PostMapping("/base/membershipGrade/queryMembershipGradeByGradeRule")
    ResponseResult queryMembershipGradeByGradeRule(@RequestBody Map<String, Object> map);


    /**
     * 通过key查询广告位
     *
     * @return
     */
    @PostMapping("/base/sysConfig/queryMePage")
    ResponseResult queryMePage();


    /**
     * 根据configKey 查询配置 feign
     */
    @PostMapping("base/sysConfig/queryConfigKeyFeign")
    String selectConfigValueFeign(@RequestParam String configKey);

}
